﻿@{
    ViewBag.Title = "添加部门";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>添加部门</h2>
<input placeholder="AccessToken" id="accessToken"/>
<input placeholder="部门名称。长度限制为1~64个字节，字符不能包括\:*?'<>|'" id="name" />
<input placeholder="父亲部门id。根部门id为1" id="parentid" />
<input placeholder="在父部门中的次序值。order值小的排序靠前" id="order" />
<input placeholder="部门id，整型。指定时必须大于1，不指定时则自动生成" id="id" />
<input type="button" onclick="submit()" value="添加"/>

<script type="text/javascript">
    function submit() {
        var accessToken = $("#accessToken").val();
        var name = $("#name").val();
        var parentId = $("#parentid").val();
        var order = $("#order").val();
        var id = $("#id").val();
        $.ajax({
            url: "/Department/Add",
            data:{"id":id,"accessToken":accessToken,"name":name,"parentId":parentId,"order":order},
            type: "Post",
            success: function (res) {
                alert(res);
                window.location.href = "/Department/List";
            }
        });
    }
</script>
